<?php

if (isset($this->message)) {
	echo $this->escape($this->message) . "<br />\n";
}

?>
<a href="<?php echo $this->baseUrl; ?>/admin/news/add">Add</a>
<script type="text/javascript">
function go(u) {
  window.location=u;
  return false;
};
</script>
<table cellpadding="2" cellspacing="2" border="1">
	<tr>
		<th>Id</th>
		<th>Title</th>
		<th>Published</th>
		<th>Poster</th>		
		<th>&nbsp;</th>
	</tr>
<?php

if (isset($this->records)) {
	foreach ($this->records as $record) {
		echo "
	<tr>
		<td onclick=\"return go(&#39;{$this->baseUrl}/admin/news/view/id/{$record['id']}&#39;);\">
			{$record['id']}
		</td>
		<td onclick=\"return go(&#39;{$this->baseUrl}/admin/news/view/id/{$record['id']}&#39;);\">
			{$record['title']}
		</td>
		<td onclick=\"return go(&#39;{$this->baseUrl}/admin/news/view/id/{$record['id']}&#39;);\">
			{$record['date_published']}
		</td>
		<td onclick=\"return go(&#39;{$this->baseUrl}/admin/news/view/id/{$record['id']}&#39;);\">
			{$record['published_by']}
		</td>
		<td>
			<a href=\"{$this->baseUrl}/admin/news/edit/id/{$record['id']}\">Edit</a>
			| <a href=\"{$this->baseUrl}/admin/news/delete/id/{$record['id']}\">Delete</a>
		</td>
	</tr>";
	}
}

?>
</table>